<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/
define('ANS', true);

require('phpcan/router.php');

$source_dir = BASE_PATH.'update/';
$source_dir = '/Users/oscarotero/Sites/phpcan_branches/1.0/';
$destination_dir = BASE_PATH;

$operations = array(

	//Update admin
	array(
		'active' => 1,
		'dirs' => 'modules/admin/',
		'options' => array(
			'replace' => true,
			'delete' => true
		)
	),

	//Update phpcan
	array(
		'active' => 0,
		'dirs' => 'phpcan',
		'options' => array(
			'replace' => true,
			'ignore' => '#(/cache/|/config/|/languages/|/logs/)#'
		)
	),
	
	//Update common
	array(
		'active' => 0,
		'dirs' => 'common',
		'options' => array(
			'filter' => '#(/ckeditor-|csans-|jquery-|jquery\.ansforms-|jquery\.colorbox-|jquery\.floatheader-|jquery\.quicksearch|jquery\.ui-)#'
		)
	)
);

$File = new \files\File;

foreach ($operations as $operation) {
	if (!$operation['active']) {
		continue;
	}

	$operation['options']['test_mode'] = false;

	$action = array();

	$File->mergeFolders($source_dir.$operation['dirs'], $destination_dir.$operation['dirs'], $operation['options'], $action);

	$Debug->e($action);
}
?>